﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="Companies.aspx.vb" Inherits="MyInventory._Companies" %>
<asp:Content ID="HeaderContent" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">

<asp:Table id="tblTitle" runat="server" width="100%" BorderWidth="0">
<asp:TableRow>
    <asp:TableCell width="100%" HorizontalAlign="Center" BackColor="#000066"><asp:label id="lblTitle" runat="server" ForeColor="White" Font-Bold="True" Font-Size="Large">Text read from Page_Load</asp:label></asp:TableCell>
</asp:TableRow>
</asp:Table>

<hr />

<asp:Table id="tblDetail" runat="server" width="100%" BorderWidth="0">
<asp:TableRow>
    <asp:TableCell>
		<asp:button id="btnAddNew" Text="Add New Company" CssClass="Button" Runat="server" CausesValidation="False"></asp:button>
    </asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell>

<asp:Panel id="pnlForm" Visible="False" Runat="server" Width="100%" BorderWidth="1" BackColor="Silver">

	<asp:Table id="Table1" runat="server" width="100%">
        <asp:TableRow>
			<asp:TableCell CssClass="FormLabel" width="15%" HorizontalAlign="Right">Company Name:</asp:TableCell>
			<asp:TableCell CssClass="FormInput">
				<asp:textbox CssClass="FormInput" id="txtCompanyName" runat="server" Columns="60" MaxLength="60" EnableViewState="False"></asp:textbox>&nbsp;
				<asp:RequiredFieldValidator id="rfvCompanyName" runat="server" ErrorMessage="Required!" Display="Dynamic" ControlToValidate="txtCompanyName"></asp:RequiredFieldValidator></asp:TableCell>
		</asp:TableRow>
        <asp:TableRow>
			<asp:TableCell CssClass="FormLabel" width="15%" HorizontalAlign="Right">Address:</asp:TableCell>
			<asp:TableCell CssClass="FormInput">
				<asp:textbox id="txtAddress" runat="server" Columns="60" MaxLength="255" EnableViewState="False" Rows="3" TextMode="MultiLine"></asp:textbox>&nbsp;
				<asp:RequiredFieldValidator id="rfvAddress" runat="server" ErrorMessage="Required!" Display="Dynamic" ControlToValidate="txtAddress"></asp:RequiredFieldValidator></asp:TableCell>
		</asp:TableRow>
        <asp:TableRow>
			<asp:TableCell CssClass="FormLabel" width="15%" HorizontalAlign="Right">City:</asp:TableCell>
			<asp:TableCell CssClass="FormInput">
				<asp:textbox id="TxtCity" runat="server" Columns="50" MaxLength="50" EnableViewState="False"></asp:textbox>&nbsp;
				<asp:RequiredFieldValidator id="rfvCity" runat="server" ErrorMessage="Required!" Display="Dynamic" ControlToValidate="txtCity"></asp:RequiredFieldValidator></asp:TableCell>
		</asp:TableRow>
		<asp:TableRow>
			<asp:TableCell CssClass="FormLabel" width="15%" HorizontalAlign="Right">State:</asp:TableCell>
			<asp:TableCell CssClass="FormInput">
				<asp:textbox id="txtState" runat="server" Columns="30" MaxLength="30" EnableViewState="False"></asp:textbox>&nbsp;
				<asp:RequiredFieldValidator id="rfvState" runat="server" ErrorMessage="Required!" Display="Dynamic" ControlToValidate="txtState"></asp:RequiredFieldValidator></asp:TableCell>
		</asp:TableRow>
		<asp:TableRow>
			<asp:TableCell CssClass="FormLabel" width="15%" HorizontalAlign="Right">Zip code:</asp:TableCell>
			<asp:TableCell CssClass="FormInput">
				<asp:textbox id="txtZipcode" runat="server" Columns="20" MaxLength="20" EnableViewState="False"></asp:textbox>&nbsp;
				<asp:RequiredFieldValidator id="RequiredFieldValidator1" runat="server" ErrorMessage="Required!" Display="Dynamic" ControlToValidate="txtZipcode"></asp:RequiredFieldValidator></asp:TableCell>
		</asp:TableRow>
		<asp:TableRow>
			<asp:TableCell CssClass="FormLabel" width="15%" HorizontalAlign="Right">Country:</asp:TableCell>
			<asp:TableCell CssClass="FormInput">
				<asp:textbox id="txtCountry" runat="server" Columns="50" MaxLength="50" EnableViewState="False"></asp:textbox>&nbsp;
				<asp:RequiredFieldValidator id="RequiredFieldValidator2" runat="server" ErrorMessage="Required!" Display="Dynamic" ControlToValidate="txtCountry"></asp:RequiredFieldValidator></asp:TableCell>
		</asp:TableRow>
		<asp:TableRow>
			<asp:TableCell CssClass="FormLabel" width="15%" HorizontalAlign="Right">Phone number:</asp:TableCell>
			<asp:TableCell CssClass="FormInput">
				<asp:textbox id="txtPhone" runat="server" Columns="30" MaxLength="30" EnableViewState="False"></asp:textbox>&nbsp;
				<asp:RequiredFieldValidator id="RequiredFieldValidator3" runat="server" ErrorMessage="Required!" Display="Dynamic" ControlToValidate="txtPhone"></asp:RequiredFieldValidator></asp:TableCell>
		</asp:TableRow>
		<asp:TableRow>
			<asp:TableCell CssClass="FormLabel" width="15%" HorizontalAlign="Right">Fax number:</asp:TableCell>
			<asp:TableCell CssClass="FormInput">
				<asp:textbox id="txtFax" runat="server" Columns="30" MaxLength="30" EnableViewState="False"></asp:textbox>&nbsp;
				<asp:RequiredFieldValidator id="RequiredFieldValidator4" runat="server" ErrorMessage="Required!" Display="Dynamic" ControlToValidate="txtFax"></asp:RequiredFieldValidator></asp:TableCell>
		</asp:TableRow>
		<asp:TableRow>
			<asp:TableCell CssClass="FormLabel" width="15%" HorizontalAlign="Right">Activate:</asp:TableCell>
			<asp:TableCell CssClass="FormInput">
				<asp:CheckBox id="chkActivate" runat="server" EnableViewState="False" Checked="True"></asp:CheckBox>&nbsp; (Recommended)</asp:TableCell>
		</asp:TableRow>
		<asp:TableRow>
			<asp:TableCell>&nbsp;</asp:TableCell>
			<asp:TableCell>
				<asp:Button id="btnSave" Text="Save Changes" CssClass="Button" Runat="server"></asp:Button></asp:TableCell>
		</asp:TableRow>
	</asp:Table>
</asp:Panel>

</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
    <asp:TableCell VerticalAlign="Top">
        <asp:datagrid id="dgCompanies" runat="server" AllowPaging="True" AutoGenerateColumns="False" AllowSorting="True" DataKeyField="ID" CellSpacing="2" ShowFooter="False" CellPadding="2" Width="100%">
				<SelectedItemStyle CssClass="DataGrid_SelectedItemStyle" />
				<ItemStyle CssClass="DataGrid_ItemStyle" />
				<AlternatingItemStyle CssClass="DataGrid_AlternatingItemStyle" />
				<HeaderStyle CssClass="DataGrid_HeaderStyle" BackColor="#E4E4E4" />
				<FooterStyle CssClass="DataGrid_FooterStyle" />
				<Columns>
					<asp:BoundColumn DataField="IsActive" SortExpression="IsActive" HeaderText="Active" />
					<asp:BoundColumn DataField="CompanyName" SortExpression="CompanyName" HeaderText="Company" ItemStyle-Wrap="False" />
					<asp:BoundColumn DataField="Address" SortExpression="Address" HeaderText="Address" />
					<asp:BoundColumn DataField="City" SortExpression="City" HeaderText="City" ItemStyle-Wrap="False" />
					<asp:BoundColumn DataField="State" SortExpression="State" HeaderText="State" />
					<asp:BoundColumn DataField="Zipcode" SortExpression="Zipcode" HeaderText="Zipcode" />
					<asp:BoundColumn DataField="Country" SortExpression="Country" HeaderText="Country" ItemStyle-Wrap="False" />
					<asp:BoundColumn DataField="Phone" SortExpression="Phone" HeaderText="Phone" />
					<asp:BoundColumn DataField="Fax" SortExpression="Fax" HeaderText="Fax" />
					<asp:ButtonColumn Text="Activate" ButtonType="PushButton" CommandName="Select"  ItemStyle-HorizontalAlign="Center" />
					<asp:ButtonColumn Text="Edit" ButtonType="PushButton" CommandName="Select"  ItemStyle-HorizontalAlign="Center"  />
					<asp:ButtonColumn Text="Delete" ButtonType="PushButton" CommandName="Select"  ItemStyle-HorizontalAlign="Center"  />
				</Columns>
				<PagerStyle CssClass="DataGrid_PagerStyle" Mode="NumericPages"  BackColor="#E4E4E4" />
			</asp:datagrid>
			<input id="htmlHiddenSortExpression" type="hidden" value="CompanyName" name="htmlHiddenSortExpression" runat="server"/>	
        </asp:TableCell>
</asp:TableRow>
</asp:Table>

<br />
<span  class="Message">
<asp:label id="lblMsg" runat="server">MSG: <%= strMsg%></asp:label>
</span><br />
<span class="ErrorMessage">
<asp:label id="lblErrorMsg" runat="server">ERROR: <%= strErrorMsg%></asp:label>
</span>

</asp:Content>
